<template>
  <div class="headerWrapper">
    <div class="topNav">
      <div class="tabs">
        <img width="132" height="auto" :src="imgUrl" />
        <ul class="nav">
          <nuxt-link v-for="(item, index) in arr" :key="index" :to="item.link">{{ item.name }}</nuxt-link>
        </ul>
      </div>
      <!-- <Search placeholder="Search" v-if="curIndex === 1" /> -->
      <div class="contract">
        <ul class="address flex">
          <li class="address-item">
            <a href="https://twitter.com/lijnwen" target="_blank">
              <img :src="require('~/assets/images/icons/twitter.png')" />
            </a>
          </li>
          <li class="address-item">
            <a href="https://twitter.com/lijnwen" target="_blank">
              <img :src="require('~/assets/images/icons/tele.png')" />
            </a>
          </li>
          <li class="address-item">
            <a href="https://twitter.com/lijnwen" target="_blank">
              <img :src="require('~/assets/images/icons/discord.png')" />
            </a>
          </li>
          <li class="address-item">
            <a href="https://twitter.com/lijnwen" target="_blank">
              <img :src="require('~/assets/images/icons/github.png')" />
            </a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { Component } from 'nuxt-property-decorator'
import { BaseVue } from '@/plugins/base-vue'
import { IHeaderArr } from './const'
import Search from './Search.vue'
@Component({
  components: {
    Search,
  },
})
export default class Header extends BaseVue {
  imgUrl = require('~/assets/images/JO.svg')
  arr: IHeaderArr[] = [
    {
      link: '/home',
      name: 'Home',
    },
    {
      link: '/space/friends',
      name: 'Space',
    },
    {
      link: '/login',
      name: 'Login',
    },
  ]
  curIndex = 2

  liClick(item: IHeaderArr, index: number) {
    this.curIndex = index
  }
}
</script>

<style lang="scss" scoped>
::v-deep .search {
  margin-left: 0 !important;

  input {
    width: 200px;
  }
}

.headerWrapper {
  position: fixed;
  z-index: 100;
  top: 0;
  width: 100%;
  background: #000000;
}

.topNav {
  justify-content: space-between;
  align-items: center;
  display: flex;
  box-sizing: border-box;
  width: 62.5%;
  margin: 0 auto;

  .contract {
    margin-left: 100px;

    ul {
      display: flex;

      li {
        margin-right: 24px;

        &:last-child {
          margin-right: 0;
        }
      }
    }
  }

  .tabs {
    align-items: center;
    display: flex;

    img {
      margin-right: 100px;
    }
  }

  ul.nav {
    list-style-type: none;
    white-space: nowrap;
    overflow: hidden;
    display: flex;

    a {
      padding: 0 20px;

      cursor: pointer;
      transition: all 0.5s;
      display: inline-block;
      color: white;
      text-align: center;
      overflow: hidden;
      text-decoration: none;
      /* 去除下划线 */
      font-size: 16px;

      &.active {
        color: #03e9f4 !important;
      }

      &:hover {
        color: #03e9f4;
      }
    }
  }
}
</style>